#pragma once
#include <vector>
#include <string>
#include "Evaluation.h"
#include "Solution.h"

class InitialPopulationFactory;
class MatingSelection;
class Crossover;
class Mutation;
class LocalSearch;
class EnvironmentSelection;

class MemeticAlgorithm{
	public:
		static const int POPULATION_SIZE = 100;

		MemeticAlgorithm(InitialPopulationFactory *ipf,
			MatingSelection *ms, Crossover *co, Mutation *mut,
			LocalSearch *ls, EnvironmentSelection *es, int maxGeneration = 100):
			_ipf(ipf), _ms(ms), _co(co), _mut(mut), _ls(ls),
				_es(es), _maxGeneration(maxGeneration),
				_bestSolution(Evaluation::GetJobNum()) {}
		virtual void SetLocalSearchValue(Solution &originSolution, Solution &LSSolution ) = 0;
		Solution Run();
	protected:
		std::string _name;
		std::vector<Solution> _population;
		Solution _bestSolution;
		int _maxGeneration;

		InitialPopulationFactory *_ipf;
		MatingSelection *_ms;
		Crossover *_co;
		Mutation *_mut;
		LocalSearch *_ls;
		EnvironmentSelection *_es;
		
};